#include <iostream>
#include <string>

using namespace std;

int zFunctionSearching(const string& text, const string& pattern) {
    const int patternLen = pattern.length();
    const int len = text.length() + patternLen + 1;

    int* z = new int[len];

    //z-function from all string is equal length of the string
    z[0] = len;
    int R = 1;

    for (int i = 1; i < len; ++i) {
        //calculation of the z-function
        z[i] = 0;
		//universal separator
        if (i == patternLen) continue;

        if (i >= R + z[R] - 1) {
            //unexplored part of the string
            while (i + z[i] < len && i + z[i] != patternLen) {
                if (i + z[i] < patternLen && pattern[z[i]] != pattern[i + z[i]]) break;
                if (i + z[i] > patternLen && pattern[z[i]] != text[i + z[i] - patternLen - 1]) break;
                ++z[i];
            }
            R = i;
        } else {
            //we are in a substring that matches the prefix of the entire string
            if (z[i - R] < R + z[R] - i) 
                z[i] = z[i - R];
            else {
				//calculation value of z-function by simple cycle, which compared elements
                int k = R + z[R] + z[i];
                while (k < len && k != patternLen && k - i != patternLen) {
                    if (k < patternLen && pattern[k - i] != pattern[k]) break;
                    if (k - i < patternLen && k > patternLen && pattern[k - i] != text[k - patternLen - 1]) break;
                    ++z[i];
                    ++k;
                }
                z[i] = z[i] + R + z[R] - i;
                R = i;
            }
        }

		//waiting for answer
        if (z[i] == patternLen && i > patternLen) {
            delete[] z;
            return i - patternLen - 1;
        }
    }

    delete[] z;
    return -1;
}


int main() {
    string text, pattern;
    text = "";  
    char ch;
    ch = getchar();

    //reading text
    while (ch != '\n' && ch != EOF) {
        text = text + ch;
        ch = getchar();
    }

    pattern = "";
    ch = getchar();

    //reading pattern
    while (ch != '\n' && ch != EOF) {
        pattern = pattern + ch;
        ch = getchar();
    }

    //while pattern is not empty, handle requests
    while (pattern != "") {
        if (text.length() < pattern.length()) cout<<"Too long pattern"<<endl;
        else {
            int answer = zFunctionSearching(text, pattern);
            if (answer != -1) 
                cout << answer << endl;
            else cout<<"There is no such a pattern in your text"<<endl;
        }

        pattern = "";
        ch = getchar();

        //reading new pattern
        while (ch != '\n' && ch != EOF) {
            pattern = pattern + ch;
            ch = getchar();
		}

    }

    return 0;
}

